package com.thinksns.sociax.t4.model;

import com.thinksns.sociax.thinksnsbase.bean.SociaxItem;
import com.thinksns.sociax.thinksnsbase.exception.DataInvalidException;

import org.json.JSONException;
import org.json.JSONObject;

/** 
 * 类说明： 充值  
 * @author  Zoey    
 * @date    2015年10月15日
 * @version 1.0
 */
public class ModelCharge extends SociaxItem {

	private String serial_number;
	private int charge_type;
	private double charge_value;
	private int uid;
	private int ctime;
	private int status;
	private double charge_sroce;
	private String charge_order;
	private int charge_id;
	//微信支付
	private String noncestr;
	private String prepayid;
	private String appid;
	private String packagevalue;
	private String partnerid;
	private long timestamp;
	private String sign;
	private String out_trade_no;
	private String url;//用户支付宝支付

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getNoncestr() {
		return noncestr;
	}

	public void setNoncestr(String noncestr) {
		this.noncestr = noncestr;
	}

	public String getPrepayid() {
		return prepayid;
	}

	public void setPrepayid(String prepayid) {
		this.prepayid = prepayid;
	}

	public String getAppid() {
		return appid;
	}

	public void setAppid(String appid) {
		this.appid = appid;
	}

	public String getPackagevalue() {
		return packagevalue;
	}

	public void setPackagevalue(String packagevalue) {
		this.packagevalue = packagevalue;
	}

	public String getPartnerid() {
		return partnerid;
	}

	public void setPartnerid(String partnerid) {
		this.partnerid = partnerid;
	}

	public long getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getOut_trade_no() {
		return out_trade_no;
	}

	public void setOut_trade_no(String out_trade_no) {
		this.out_trade_no = out_trade_no;
	}

	public String getSerial_number() {
		return serial_number;
	}

	public void setSerial_number(String serial_number) {
		this.serial_number = serial_number;
	}

	public int getCharge_type() {
		return charge_type;
	}

	public void setCharge_type(int charge_type) {
		this.charge_type = charge_type;
	}

	public double getCharge_value() {
		return charge_value;
	}

	public void setCharge_value(double charge_value) {
		this.charge_value = charge_value;
	}

	public int getUid() {
		return uid;
	}

	public void setUid(int uid) {
		this.uid = uid;
	}

	public int getCtime() {
		return ctime;
	}

	public void setCtime(int ctime) {
		this.ctime = ctime;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public double getCharge_sroce() {
		return charge_sroce;
	}

	public void setCharge_sroce(double charge_sroce) {
		this.charge_sroce = charge_sroce;
	}

	public String getCharge_order() {
		return charge_order;
	}

	public void setCharge_order(String charge_order) {
		this.charge_order = charge_order;
	}

	public int getCharge_id() {
		return charge_id;
	}

	public void setCharge_id(int charge_id) {
		this.charge_id = charge_id;
	}

	public ModelCharge() {
		super();
	}

	public ModelCharge(JSONObject data) throws DataInvalidException {
		super(data);
		
			try {
				if(data.has("serial_number")) this.setSerial_number(data.getString("serial_number"));
				if(data.has("charge_type")) this.setCharge_type(data.getInt("charge_type"));
				if(data.has("charge_value")) this.setCharge_value(data.getDouble("charge_value"));
				if(data.has("uid")) this.setUid(data.getInt("uid"));
				if(data.has("ctime")) this.setCtime(data.getInt("ctime"));
				if(data.has("status")) this.setStatus(data.getInt("status"));
				if(data.has("charge_sroce")) this.setCharge_sroce(data.getDouble("charge_sroce"));
				if(data.has("charge_order")) this.setCharge_order(data.getString("charge_order"));
				if(data.has("charge_id")) this.setCharge_id(data.getInt("charge_id"));

				if(data.has("noncestr")) this.setNoncestr(data.getString("noncestr"));
				if(data.has("prepayid")) this.setPrepayid(data.getString("prepayid"));
				if(data.has("appid")) this.setAppid(data.getString("appid"));
				if(data.has("package")) this.setPackagevalue(data.getString("package"));
				if(data.has("partnerid")) this.setPartnerid(data.getString("partnerid"));
				if(data.has("timestamp")) this.setTimestamp(data.getLong("timestamp"));
				if(data.has("sign")) this.setSign(data.getString("sign"));
				if(data.has("out_trade_no")) this.setOut_trade_no(data.getString("out_trade_no"));
				if(data.has("url")) this.setUrl(data.getString("url"));
			} catch (JSONException e) {
				e.printStackTrace();
			}
	}

	@Override
	public boolean checkValid() {
		return false;
	}

	@Override
	public String toString() {
		return "ModelCharge{" +
				"serial_number='" + serial_number + '\'' +
				", charge_type=" + charge_type +
				", charge_value=" + charge_value +
				", uid=" + uid +
				", ctime=" + ctime +
				", status=" + status +
				", charge_sroce=" + charge_sroce +
				", charge_order='" + charge_order + '\'' +
				", charge_id=" + charge_id +
				", noncestr='" + noncestr + '\'' +
				", prepayid='" + prepayid + '\'' +
				", appid='" + appid + '\'' +
				", packagevalue='" + packagevalue + '\'' +
				", partnerid='" + partnerid + '\'' +
				", timestamp=" + timestamp +
				", sign='" + sign + '\'' +
				", out_trade_no='" + out_trade_no + '\'' +
				", url='" + url + '\'' +
				'}';
	}

	@Override
	public String getUserface() {
		return null;
	}
}
